package com.ruoyi.test4.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.test4.mapper.EquipmentMapper;
import com.ruoyi.test4.domain.Equipment;
import com.ruoyi.test4.service.IEquipmentService;

/**
 * 装备管理Service业务层处理
 * 
 * @author 22082109czy
 * @date 2025-07-09
 */
@Service
public class EquipmentServiceImpl implements IEquipmentService 
{
    @Autowired
    private EquipmentMapper equipmentMapper;

    @Override
    public List<Equipment> findByStatusAndDispatch(String status, String dispatchStatus) {
        // 通过 Mapper 执行 SQL，筛选状态和派出状态符合条件的数据
        return equipmentMapper.selectByStatusAndDispatch(status, dispatchStatus);
    }
    /**
     * 查询装备管理
     *
     * @param id 装备管理主键
     * @return 装备管理
     */
    @Override
    public Equipment selectEquipmentById(Long id)
    {
        return equipmentMapper.selectEquipmentById(id);
    }

    /**
     * 查询装备管理列表
     * 
     * @param equipment 装备管理
     * @return 装备管理
     */
    @Override
    public List<Equipment> selectEquipmentList(Equipment equipment)
    {
        return equipmentMapper.selectEquipmentList(equipment);
    }

    /**
     * 新增装备管理
     * 
     * @param equipment 装备管理
     * @return 结果
     */
    @Override
    public int insertEquipment(Equipment equipment)
    {
        equipment.setCreateTime(DateUtils.getNowDate());
        return equipmentMapper.insertEquipment(equipment);
    }

    /**
     * 修改装备管理
     * 
     * @param equipment 装备管理
     * @return 结果
     */
    @Override
    public int updateEquipment(Equipment equipment)
    {
        equipment.setUpdateTime(DateUtils.getNowDate());
        return equipmentMapper.updateEquipment(equipment);
    }

    /**
     * 批量删除装备管理
     * 
     * @param ids 需要删除的装备管理主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentByIds(Long[] ids)
    {
        return equipmentMapper.deleteEquipmentByIds(ids);
    }

    /**
     * 删除装备管理信息
     * 
     * @param id 装备管理主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentById(Long id)
    {
        return equipmentMapper.deleteEquipmentById(id);
    }
}
